#include <nxos.h>

#define MAX_ARGS 1024

NX_Error PowerBoxBuiltinEnv(int argc, char *argv[], char * env)
{
    char *array[MAX_ARGS + 1];
    int envc;
    int i;
    char envp[NX_FILE_MAX_PATH] = {0};

    NX_Printf("* env addr=%p, env line=%s\n", env, env);

    NX_StrCopyN(envp, env, NX_FILE_MAX_PATH);

    envc = NX_EnvToArray(envp, array, MAX_ARGS);
    if (envc > 0)
    {
        for (i = 0; i < envc; i++)
        {
            NX_Printf("env[%d] => %s\n", i, array[i]);
        }
        NX_Printf("\r\n");
    }
    
    return NX_EOK;
}
